package cn.edu.ctbu.datajpa01.api;


import cn.edu.ctbu.datajpa01.domain.Student;
import cn.edu.ctbu.datajpa01.service.StudentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api")
@Slf4j
public class StudentApiController {



    @Autowired
    private StudentService studentService;



    @GetMapping("/student/list")
    public List<Student> list(){

        return studentService.findAll();
    }

    @PostMapping("/student/insert")
    public void insert(Student student){

        log.info(student.toString());

    }





}
